/*
 * @Description: 导出组件
 * @Author: Rfan
 * @Date: 2022-06-22 09:41:23
 * @LastEditTime: 2023-01-06 10:58:04
 */

import { Button, Dropdown, Menu } from 'antd';
import Excel from './components/Excel';
import CDExport from './components/CDExport';
import SipExport from './components/SipExport';
import { IBaseProp } from '@/components/LevelTable';
import { useArchiveCollectionContext } from '../../../contexts/ArchiveCollectionContext';

interface IExportOptProps {
  info: IBaseProp;
  selectItems: any;
}

const ExportOpt = (props: IExportOptProps) => {
  const { info, selectItems } = props;
  console.log('info00000', info);

  const menu = (
    <Menu
      items={[
        {
          key: 'excel',
          label: <Excel info={info} selectItems={selectItems} />
        },
        {
          key: 'cd',
          label: <CDExport info={info} selectItems={selectItems} />
        },
        {
          key: 'sip',
          label: <SipExport info={info} selectItems={selectItems} />
        }
      ]}
    />
  );

  return (
    <Dropdown
      disabled={selectItems.length === 0}
      overlay={menu}
      placement="bottom"
      trigger={['click']}
    >
      <Button>导出</Button>
    </Dropdown>
  );
};

export default ExportOpt;
